/*global jQuery, $, geo_position_js */
var rateme = rateme || {};
	
(function ($) {
	function Geo() {
		var self = this;

		this.lat = 0;
		this.lng = 0;

	}	
	
	Geo.prototype = {
		getPositionLatLng : function () {
			var self = this;
			if (geo_position_js.init()) {
				
				geo_position_js.getCurrentPosition(
					function (p) {
		
						self.lat = p.coords.latitude.toFixed(2);
						self.lng = p.coords.longitude.toFixed(2);
					
				
						$(self).trigger('success', [{
							'lat' : self.lat,
							'lng' : self.lng 
						}]);
						
					}, 
					
					// error callback
					function (p) {
						return 'error=' + p.message;
					}, 
					
					{ 'enableHighAccuracy' : true }
				);
		
			} else {
				return false;
			}
		},
		
		getSavedPositionLatLng : function () {
			return {
				lat : self.lat,
				lng : self.lng
			};
		}		
		
	};
	
	rateme.geo = Geo;
	
}(jQuery));
 
	
